<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>InterpréteurAP6:  Fichier source de LecteurPhraseAvecArbre.h</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Généré par Doxygen 1.7.4 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Recherche');
--></script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">InterpréteurAP6</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Page&#160;principale</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Fichiers</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Recherche" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>Liste&#160;des&#160;fichiers</span></a></li>
      <li><a href="globals.html"><span>Membres&#160;de&#160;fichier</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">LecteurPhraseAvecArbre.h</div>  </div>
</div>
<div class="contents">
<a href="LecteurPhraseAvecArbre_8h.html">Aller à la documentation de ce fichier.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef LECTEURPHRASEAVECARBRE_H_</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define LECTEURPHRASEAVECARBRE_H_</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &quot;<a class="code" href="Symbole_8h.html">Symbole.h</a>&quot;</span>
<a name="l00005"></a>00005 <span class="preprocessor">#include &quot;<a class="code" href="LecteurSymbole_8h.html" title="La spécification de la classe LecteurSymbole Décrit la liste des méthodes et attributs associés à la ...">LecteurSymbole.h</a>&quot;</span>
<a name="l00006"></a>00006 <span class="preprocessor">#include &quot;<a class="code" href="TableSymboles_8h.html">TableSymboles.h</a>&quot;</span>
<a name="l00007"></a>00007 <span class="preprocessor">#include &quot;<a class="code" href="Arbre_8h.html">Arbre.h</a>&quot;</span>
<a name="l00008"></a>00008 <span class="preprocessor">#include &quot;<a class="code" href="Exception_8h.html">Exception.h</a>&quot;</span>
<a name="l00009"></a>00009 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00010"></a>00010 <span class="keyword">using namespace </span>std;
<a name="l00011"></a>00011 
<a name="l00012"></a><a class="code" href="classLecteurPhraseAvecArbre.html">00012</a> <span class="keyword">class </span><a class="code" href="classLecteurPhraseAvecArbre.html">LecteurPhraseAvecArbre</a>
<a name="l00013"></a>00013 {
<a name="l00014"></a>00014 <span class="keyword">public</span>:
<a name="l00015"></a>00015         <a class="code" href="classLecteurPhraseAvecArbre.html">LecteurPhraseAvecArbre</a>(<span class="keywordtype">string</span> nomFich);  <span class="comment">// Construit un lecteur de phrase pour interpreter</span>
<a name="l00016"></a>00016                                                  <span class="comment">//  le programme dans le fichier nomFich</span>
<a name="l00017"></a>00017 
<a name="l00018"></a>00018         <span class="keywordtype">void</span> analyse();  <span class="comment">// Si le contenu du fichier est conforme à la grammaire,</span>
<a name="l00019"></a>00019                          <span class="comment">//   cette méthode se termine normalement et affiche un message &quot;Syntaxe correcte&quot;.</span>
<a name="l00020"></a>00020                          <span class="comment">//   la table des symboles (ts) et l&#39;arbre abstrait (arbre) auront été construits</span>
<a name="l00021"></a>00021                          <span class="comment">// Sinon, le programme sera interrompu (exit).</span>
<a name="l00022"></a>00022         
<a name="l00023"></a>00023         <span class="keywordtype">void</span> afficherEnC(<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> indentation = 0);
<a name="l00024"></a>00024 
<a name="l00025"></a><a class="code" href="classLecteurPhraseAvecArbre.html#a0ece720e0dabc523aedf08357b7ec4c4">00025</a>         <span class="keywordtype">int</span> <a class="code" href="classLecteurPhraseAvecArbre.html#a0ece720e0dabc523aedf08357b7ec4c4">getNbErreur</a>() { <span class="keywordflow">return</span> nbErreur; };
<a name="l00026"></a><a class="code" href="classLecteurPhraseAvecArbre.html#a14e9f9598948df424aec947ac2d4d4e2">00026</a>         <span class="keyword">inline</span> <a class="code" href="classTableSymboles.html">TableSymboles</a> <a class="code" href="classLecteurPhraseAvecArbre.html#a14e9f9598948df424aec947ac2d4d4e2">getTs</a> ()    { <span class="keywordflow">return</span> ts;    } <span class="comment">// accesseur </span>
<a name="l00027"></a><a class="code" href="classLecteurPhraseAvecArbre.html#ac7dba3fc9792c1a812d572a781188ca1">00027</a>         <span class="keyword">inline</span> <a class="code" href="classNoeud.html">Noeud</a>*        <a class="code" href="classLecteurPhraseAvecArbre.html#ac7dba3fc9792c1a812d572a781188ca1">getArbre</a> () { <span class="keywordflow">return</span> arbre; } <span class="comment">// accesseur</span>
<a name="l00028"></a>00028         
<a name="l00029"></a>00029 
<a name="l00030"></a>00030 <span class="keyword">private</span>:
<a name="l00031"></a>00031     <a class="code" href="classLecteurSymbole.html" title="La classe représentant les LecteurSymbole. Cette classe permet de représenter sous la forme d&#39;un obje...">LecteurSymbole</a> ls;    <span class="comment">// le lecteur de symboles utilisé pour analyser le fichier</span>
<a name="l00032"></a>00032     <a class="code" href="classTableSymboles.html">TableSymboles</a>  ts;    <span class="comment">// la table des symboles valués</span>
<a name="l00033"></a>00033     <a class="code" href="classNoeud.html">Noeud</a>*         arbre; <span class="comment">// l&#39;arbre abstrait</span>
<a name="l00034"></a>00034     <span class="keywordtype">int</span>            nbErreur;
<a name="l00035"></a>00035 
<a name="l00036"></a>00036     <span class="comment">// implémentation de la grammaire</span>
<a name="l00037"></a>00037     <a class="code" href="classNoeud.html">Noeud</a>* programme();   <span class="comment">// &lt;programme&gt; ::= debut &lt;seqInst&gt; fin &lt;EOF&gt;</span>
<a name="l00038"></a>00038     <a class="code" href="classNoeud.html">Noeud</a>* seqInst();     <span class="comment">// &lt;seq_ins&gt; ::= &lt;inst&gt; ; { &lt;inst&gt; ; }</span>
<a name="l00039"></a>00039     <a class="code" href="classNoeud.html">Noeud</a>* inst();        <span class="comment">// &lt;inst&gt; ::= &lt;affectation&gt; | &lt;instSi&gt; | &lt;instTq&gt; | &lt;instRepeter&gt; | &lt;instEcrire&gt; | &lt;instLire&gt;</span>
<a name="l00040"></a>00040     <a class="code" href="classNoeud.html">Noeud</a>* affectation();       <span class="comment">// &lt;affectation&gt; ::= &lt;variable&gt; = &lt;expression&gt;</span>
<a name="l00041"></a>00041     <a class="code" href="classNoeud.html">Noeud</a>* instSi();      <span class="comment">// &lt;instSi&gt; ::= si (&lt;expBool&gt;) &lt;seqInst&gt; { sinonsi (&lt;expBool&gt;) &lt;seqInst&gt; } [ sinon &lt;seqInst&gt; ] finsi</span>
<a name="l00042"></a>00042     <a class="code" href="classNoeud.html">Noeud</a>* instTq();      <span class="comment">// &lt;instTq&gt; ::= tantque (&lt;expBool&gt;) &lt;seqInst&gt; fintantque</span>
<a name="l00043"></a>00043     <a class="code" href="classNoeud.html">Noeud</a>* instRepeter(); <span class="comment">// &lt;instRepeter&gt; ::= repeter &lt;seqInst&gt; jusqua (&lt;expBool&gt;)</span>
<a name="l00044"></a>00044     <a class="code" href="classNoeud.html">Noeud</a>* instPour();          <span class="comment">// &lt;instPour&gt; ::= pour ( &lt;affectation&gt; ; &lt;expBool&gt; ; &lt;affectation&gt;) &lt;seqInst&gt; finpour</span>
<a name="l00045"></a>00045     <a class="code" href="classNoeud.html">Noeud</a>* instLire();          <span class="comment">// &lt;instLire&gt; ::= lire ( &lt;variable&gt; )</span>
<a name="l00046"></a>00046     <a class="code" href="classNoeud.html">Noeud</a>* instEcrire();        <span class="comment">// &lt;instEcrire&gt; ::= ecrire ( &lt;expression&gt; | &lt;CHAINE&gt;)</span>
<a name="l00047"></a>00047     <a class="code" href="classNoeud.html">Noeud</a>* instSelon();        <span class="comment">// &lt;instSelon&gt; ::= selon ( &lt;expression&gt; | &lt;CHAINE&gt; ) cas (expression | &lt;CHAINE&gt; ) : &lt;seqInst&gt; </span>
<a name="l00048"></a>00048                                                    <span class="comment">// { cas (expression | &lt;CHAINE&gt;) : &lt;seqInst&gt; } finchoix</span>
<a name="l00049"></a>00049     <a class="code" href="classNoeud.html">Noeud</a>* expression();        <span class="comment">// &lt;expression&gt; ::= &lt;terme&gt; { &lt;opAdd&gt; &lt;terme&gt; }</span>
<a name="l00050"></a>00050     <a class="code" href="classNoeud.html">Noeud</a>* relation();    <span class="comment">// &lt;relation&gt; ::= &lt;expression&gt; { &lt;opRel&gt; &lt;expression&gt; }</span>
<a name="l00051"></a>00051     <a class="code" href="classNoeud.html">Noeud</a>* facteur();     <span class="comment">// &lt;facteur&gt; ::= &lt;entier&gt;  |  &lt;variable&gt;  | &lt;opUnaire&gt; &lt;expBool&gt; | (&lt;expBool&gt;)</span>
<a name="l00052"></a>00052     <a class="code" href="classNoeud.html">Noeud</a>* terme();       <span class="comment">// &lt;terme&gt; ::= &lt;facteur&gt; { &lt;oppMult&gt; &lt;facteur&gt; }</span>
<a name="l00053"></a>00053     <a class="code" href="classNoeud.html">Noeud</a>* expBool();   <span class="comment">// &lt;expBoolOu&gt; ::= &lt;expBoolEt&gt; { ou &lt;expBoolEt&gt; }</span>
<a name="l00054"></a>00054     <a class="code" href="classNoeud.html">Noeud</a>* expBoolEt();   <span class="comment">// &lt;expBoolEt&gt; ::= &lt;relation&gt; { et &lt;relation&gt; }</span>
<a name="l00055"></a>00055     <a class="code" href="classSymbole.html">Symbole</a> opAdd();       <span class="comment">// &lt;opAdd&gt; ::= + | -</span>
<a name="l00056"></a>00056     <a class="code" href="classSymbole.html">Symbole</a> opMult();      <span class="comment">// &lt;opMult&gt; ::= * | /</span>
<a name="l00057"></a>00057     <a class="code" href="classSymbole.html">Symbole</a> opRel();       <span class="comment">// &lt;opRel&gt; ::= == | != | &lt; | &lt;= | &gt; | &gt;=</span>
<a name="l00058"></a>00058     <a class="code" href="classSymbole.html">Symbole</a> opUnaire();    <span class="comment">// &lt;opUnaire&gt; ::= - | non</span>
<a name="l00059"></a>00059 
<a name="l00060"></a>00060     <span class="comment">// outils pour se simplifier l&#39;analyse syntaxique</span>
<a name="l00061"></a>00061     <span class="keywordtype">void</span> testerSymCour (<span class="keywordtype">string</span> ch);  <span class="comment">// si symbole courant != ch, erreur : on arrete le programme, sinon rien</span>
<a name="l00062"></a>00062     <span class="keywordtype">void</span> sauterSymCour (<span class="keywordtype">string</span> ch);  <span class="comment">// si symbole courant == ch, on passe au symbole suivant, sinon erreur : on arrete</span>
<a name="l00063"></a>00063     <span class="keywordtype">void</span> erreur (<span class="keywordtype">string</span> mess);      <span class="comment">// affiche les message d&#39;erreur mess et arrete le programme</span>
<a name="l00064"></a>00064     <span class="keywordtype">void</span> erreurDiv();
<a name="l00065"></a>00065 };
<a name="l00066"></a>00066 
<a name="l00067"></a>00067 <span class="preprocessor">#endif </span><span class="comment">/* LECTEURPHRASEAVECARBRE_H_ */</span>
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>Tout</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Fichiers</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Fonctions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Énumérations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Valeurs énumérées</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Amis</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Macros</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address class="footer"><small>Généré le Tue Dec 27 2011 03:03:26 pour InterpréteurAP6 par&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>
